Index: kvm.c
===================================================================
RCS file: /home/ncvs/src/lib/libkvm/kvm.c,v
retrieving revision 1.12.2.2
retrieving revision 1.12.2.3
diff -c -r1.12.2.2 -r1.12.2.3
*** lib/libkvm/kvm.c	23 Aug 2000 08:53:00 -0000	1.12.2.2
--- lib/libkvm/kvm.c	13 Sep 2002 14:53:43 -0000	1.12.2.3
***************
*** 206,211 ****
--- 206,215 ----
  		_kvm_syserr(kd, kd->program, "%s", mf);
  		goto failed;
  	}
+ 	if (fcntl(kd->pmfd, F_SETFD, FD_CLOEXEC) < 0) {
+ 		_kvm_syserr(kd, kd->program, "%s", mf);
+ 		goto failed;
+ 	}
  	if (S_ISCHR(st.st_mode)) {
  		/*
  		 * If this is a character special device, then check that
***************
*** 224,229 ****
--- 228,237 ----
  				_kvm_syserr(kd, kd->program, "%s", _PATH_KMEM);
  				goto failed;
  			}
+ 			if (fcntl(kd->vmfd, F_SETFD, FD_CLOEXEC) < 0) {
+ 				_kvm_syserr(kd, kd->program, "%s", _PATH_KMEM);
+ 				goto failed;
+ 			}
  		}
  	} else {
  		/*
***************
*** 232,237 ****
--- 240,249 ----
  		 * but first setup the namelist fd.
  		 */
  		if ((kd->nlfd = open(uf, O_RDONLY, 0)) < 0) {
+ 			_kvm_syserr(kd, kd->program, "%s", uf);
+ 			goto failed;
+ 		}
+ 		if (fcntl(kd->nlfd, F_SETFD, FD_CLOEXEC) < 0) {
  			_kvm_syserr(kd, kd->program, "%s", uf);
  			goto failed;
  		}
